﻿#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<string>
#include<vector>
#include<unordered_set>
using namespace std;
int firstUniqChar(string s) {
	int hash[26] = { 0 };
	for (auto e : s)
		hash[e - 'a']++;
	for (int i = 0; i < s.size(); i++)
	{
		if (hash[s[i] - 'a'] == 1)
			return i;
	}
	return -1;
}
bool isPalindrome(string s) {
	string tmp;
	for (auto e : s)
	{
		if ((e >= '0' && e <= '9') || (e >= 'a' && e <= 'z'))
			tmp += e;
		if (e >= 'A' && e <= 'Z')
			tmp += e + 32;
	}
	int left = 0, right = tmp.size() - 1;
	while (left <= right)
	{
		if (tmp[left] != tmp[right])
			return false;
		left++;
		right--;
	}
	return true;
}
int main()
{
	string s;
	getline(cin, s);
	int i = s.size() - 1;
	int ret = 0;
	while (i >= 0&&s[i]!=' ')
	{
		i--;
		ret++;
	}
	cout << ret;
	return 0;
}
string reverseStr(string s, int k) {
	int i = 0,n=s.size();
	while (i < n)
	{
		reverse(s.begin() + i, s.begin() + i + k);
		i += 2*k;
	}
	return s;
}
string reverseWords(string s) {
	int cur = 0, pre = 0,n=s.size();
	while (cur < n)
	{
		cur++;
		if (s[cur] == ' ')
		{
			reverse(s.begin() + pre, s.begin() + cur);
			pre = cur;
		}
	}
	return s;
}
int maxSubArray(vector<int>& nums) {
	int n = nums.size();
	vector<int> dp(n+1);
	int ret = INT_MIN;
	for (int i = 1; i <= n; i++)
	{
		dp[i] = max(nums[i], dp[i - 1] + nums[i]);
		ret = max(ret, dp[i]);
	}
	return ret;
}
int maxSubarraySumCircular(vector<int>& nums) {
	int n = nums.size();
	vector<int> f(n + 1), g(n + 1);
	int fmax = INT_MIN, gmin = INT_MAX,sum=0;
	for (int i = 1; i <= n; i++)
	{
		f[i] = max(nums[i], f[i - 1] + nums[i]);
		g[i] = min(nums[i], g[i - 1] + nums[i]);
		fmax = max(fmax, f[i]);
		gmin = min(gmin, g[i]);
		sum += nums[i];
	}
	int ret = fmax > (sum - gmin) ? fmax : sum - gmin;
	return ret;
}
int maxProduct(vector<int>& nums) {
	int n = nums.size();
	vector<int> f(n + 1), g(n + 1);
	f[0] = g[0] = 1;
	for (int i = 1; i < n + 1; i++)
	{
		if (nums[i] > 0)
		{
			f[i] = max(nums[i - 1], f[i - 1] * nums[i - 1]);
			g[i] = min(nums[i - 1], g[i - 1] * nums[i - 1]);
		}
		else if (nums[i] < 0)
		{
			f[i] = max(nums[i - 1], g[i - 1] * nums[i - 1]);
			g[i] = min(nums[i - 1], f[i - 1] * nums[i - 1]);
		}
	}
	return f[n];
}
int getMaxLen(vector<int>& nums) {
	int n = nums.size();
	vector<int> f(n + 1), g(n + 1);
	int ret = 0;
	for (int i = 1; i < n + 1; i++)
	{
		if (nums[i - 1] > 0)
		{
			f[i] = f[i - 1] + 1;
			g[i] = g[i - 1] + 1;
		}
		else if (nums[i - 1] < 0)
		{
			f[i] = g[i - 1] + 1;
			g[i] = f[i - 1] + 1;
		}
		ret = max(ret, f[i]);
	}
	return ret;

}
int numberOfArithmeticSlices(vector<int>& nums) {
	int n = nums.size();
	vector<int> dp(n);
	int ret = 0;
	for (int i = 2; i < n; i++)
	{
		if (nums[i] - nums[i - 1] == nums[i - 1] - nums[i - 2])
		{
			dp[i] = dp[i - 1] + 1;
		}
		ret = max(ret, dp[i]);
	}
	return ret;
}
int maxTurbulenceSize(vector<int>& arr) {
	int n = arr.size();
	vector<int> f(n, 1), g(n, 1);
	int ret = 1;
	for (int i = 1; i < n; i++)
	{
		if (arr[i - 1] < arr[i])
			f[i] = g[i] + 1;
		else if (arr[i - 1] > arr[i])
			g[i] = f[i - 1] + 1;
		ret = max(ret, max(f[i], g[i]));
	}
	return ret;
}
//string path;
//bool dfs(string s, vector<string>& wordDict)
//{
//	if (path.size() > s.size())
//		return false;
//	if (path == s)
//		return true;
//	for (int i = 0; i < wordDict.size(); i++)
//	{
//		path += wordDict[i];
//		if (dfs(s, wordDict))
//			return true;
//		int n = wordDict[i].size();
//		path.erase(path.end() - n, path.end());
//	}
//	return false;
//}
//bool wordBreak(string s, vector<string>& wordDict) {
//	return dfs(s, wordDict);
//}
bool wordBreak(string s, vector<string>& wordDict) {
	unordered_set<string> hash;
	for (auto &e : wordDict)
		hash.insert(e);
	int n = s.size();
	vector<bool> dp(n+1);
	dp[0] = true;// 保证后续填表是正确的
	s = ' ' + s;// 使原始字符串的下标统⼀ +1
	for (int i = 1; i < n + 1; i++)
	{
		for (int j = i - 1; j >= 0; j--)
		{
			if (dp[j-1]==true&&hash.count(s.substr(j, i - j + 1)))
			{
				dp[i] = true;
				break;
			}
		}
	}
	return dp[n];
}
int findSubstringInWraproundString(string s) {
	int n = s.size();
	vector<int> dp(n, 1);
	int hash[26] = { 0 };
	for (int i = 1; i < n; i++)
	{
		if (s[i - 1] + 1 == s[i] || (s[i - 1] == 'z' && s[i] == 'a'))
			dp[i] += dp[i - 1];
		hash[s[i] - 'a'] = max(hash[s[i] - 'a'], dp[i]);
	}
	int ret = 0;
	for (auto e : hash)
		ret += e;
	return ret;
}